/**
 * Copyright (c) 2012, Camelot and/or its affiliates. All rights reserved.
 * Camelot PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.camelot.ccr.global.util;

import com.alibaba.fastjson.JSON;

/**
 * <pre>
 * <请输入描述信息>
 * </pre>
 * @author Fu Dawei
 * @version V0.1, 2014-3-3 上午11:18:12
 */
public class BudgetPlanFlowObj {
	
	private Integer budgetId;
	
	private Integer collectionPlanId;
	
	private String flowType;

	/**
	 * @return the budgetId
	 */
	public Integer getBudgetId() {
		return budgetId;
	}

	/**
	 * @param budgetId the budgetId to set
	 */
	public void setBudgetId(Integer budgetId) {
		this.budgetId = budgetId;
	}

	/**
	 * @return the collectionPlanId
	 */
	public Integer getCollectionPlanId() {
		return collectionPlanId;
	}

	/**
	 * @param collectionPlanId the collectionPlanId to set
	 */
	public void setCollectionPlanId(Integer collectionPlanId) {
		this.collectionPlanId = collectionPlanId;
	}

	/**
	 * @return the flowType
	 */
	public String getFlowType() {
		return flowType;
	}

	/**
	 * @param flowType the flowType to set
	 */
	public void setFlowType(String flowType) {
		this.flowType = flowType;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		if(Utility.isNull(this.budgetId) || budgetId.intValue() <= 0){
			throw new RuntimeException("预算ID不可以为空");
		}
		
		if(Utility.isNull(this.collectionPlanId) || collectionPlanId.intValue() <= 0){
			throw new RuntimeException("收款计划不可以为空");
		}
		
		if(Utility.isEmpty(this.flowType)){
			throw new RuntimeException("类型不可以为空");
		}
		
		return "{budgetId:" + this.budgetId +",collectionPlanId:"+ this.collectionPlanId + ", flowType:\"" + this.flowType + "\"}";
	}
	
	public static void main(String[] args) {
		BudgetPlanFlowObj obj = new BudgetPlanFlowObj();
		obj.setBudgetId(1);
		obj.setCollectionPlanId(2);
		obj.setFlowType("bc");
		System.out.println(obj.toString());
		BudgetPlanFlowObj oo = JSON.toJavaObject(JSON.parseObject(obj.toString()), BudgetPlanFlowObj.class);
		System.out.println(oo.toString());
		System.out.println(oo.getFlowType());
	}
	
	

}
